﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Cart.aspx.cs" Inherits="TwoWheels.Account.Cart" EnableViewState="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Your cart</h2>
<br />

<asp:GridView ID="CartView" runat="server" CellPadding="6" AutoGenerateColumns="False" 
              DataSourceID = "objSource"
>
 <Columns>
   <asp:TemplateField HeaderText="Name">
     <ItemTemplate>
       <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' Width="250"></asp:Label>
     </ItemTemplate>
   </asp:TemplateField>
   <asp:TemplateField HeaderText="Price">
     <ItemTemplate>
       <asp:Label ID="PriceLabel" runat="server" Text='<%# Bind("Price") %>' Width="150"></asp:Label>
     </ItemTemplate>
   </asp:TemplateField>
   <asp:TemplateField  HeaderText="Quantity">
     <ItemTemplate>
       <asp:Label ID="QuantityLabel" runat="server" Text='<%# Bind("Quantity") %>' Width="150"></asp:Label>
     </ItemTemplate>
   </asp:TemplateField>
   <asp:TemplateField HeaderText = "Dec" >
         <ItemTemplate>        
            <asp:Button ID="DecButton" runat="server" 
                        CommandName="DecInCart" 
                        CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                        Text="-1"
                        OnClick="decButton" />
         </ItemTemplate> 
  </asp:TemplateField> 
   <asp:TemplateField HeaderText = "Delete" >
         <ItemTemplate>        
            <asp:Button ID="DeleteButton" runat="server" 
                        CommandName="DeleteFromCart" 
                        CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                        Text="Delete"
                        OnClick="deleteButton" />
         </ItemTemplate> 
  </asp:TemplateField> 
 </Columns>
</asp:GridView> 

<asp:ObjectDataSource SelectMethod="getCartData" ID="objSource" runat="server" 
        TypeName="TwoWheels.Account.Cart" onselecting="objSource_Selecting"></asp:ObjectDataSource>

<p>
    <asp:Button ID="makeOrderButton" runat="server" CommandName="Order" Text="Confirm" 
        onclick="makeOrderButton_Click" Visible="false"/>
    <asp:Label Font-Size="Medium" ID="emptyCartLabel" runat="server" Text="Your cart is Empty." Visible="false" />
</p>
<asp:Panel runat="server" ID="panel">
</asp:Panel>

</asp:Content>
